{template '_header'}
{php $this->followBar()}
<style type="text/css">
    .fui-navbar ~ .fui-content, .fui-content.navbar{padding-bottom:0;}
    {if $pay['credit'] == 0}
    .fui-actionsheet a.balance{display: none;}
    {/if}
    {if $pay['weixin'] == 0 && $pay['weixin_jie'] == 0}
    .fui-actionsheet a.wechat{display: none;}
    {/if}
    {if $pay['alipay'] == 0}
    .fui-actionsheet a.alipay{display: none;}
    {/if}
</style>
<div class='fui-page order-detail-page'>
    <div class="fui-header">
        <div class="fui-header-left">
            <a class="back" href="{php echo mobileUrl('creditshop/log')}"></a>
        </div>
        <div class="title">订单详情</div>
        <div class="fui-header-right" onclick="location.href='{php echo mobileUrl('creditshop/index')}'">
            <span class="icon icon-home" style="font-size:1.1rem;"></span>
        </div>
    </div>
    <div class='fui-content navbar'>
        <div class='fui-list-group result-list'>
            <div class='fui-list order-status'>
                <div class='fui-list-inner'>
                    <div class='title'>
                        {if $goods['type']==1}
                            {if $log['status'] ==1}未中奖{/if}
                        {/if}
                        {if $goods['goodstype']==0}
                            {if $goods['isverify']==1}
                                {if $log['status'] ==2}待兑换{/if}
                                {if $set['isreply'] == 1}
                                    {if $log['status'] ==3 && $log['iscomment'] == 0 }等待评价{/if}
                                    {if $log['status'] ==3 && $log['iscomment'] == 1 }追加评价{/if}
                                    {if $log['status'] ==3 && $log['iscomment'] == 2 }已完成{/if}
                                {else}
                                    {if $log['status'] ==3}已完成{/if}
                                {/if}
                            {else}
                                {if $log['status'] ==2 && $log['addressid'] == 0 }{if $goods['type']==0}已兑换{else}已中奖{/if}，请选择收货地址{/if}
                                {if $log['status'] ==2 && $log['addressid'] > 0 && $log['time_send'] == 0}等待卖家发货{/if}
                                {if $log['status'] ==3 && $log['time_send'] > 0 && $log['time_finish'] ==0 }卖家已发货，等待签收{/if}
                                {if $set['isreply'] == 1}
                                    {if $log['status'] ==3 && $log['time_finish'] > 0 && $log['iscomment'] == 0 }待评价{/if}
                                    {if $log['status'] ==3 && $log['time_finish'] > 0 && $log['iscomment'] == 1 }追加评价{/if}
                                    {if $log['status'] ==3 && $log['time_finish'] > 0 && $log['iscomment'] == 2 }已完成{/if}
                                {else}
                                    {if $log['status'] ==3 && $log['time_finish'] > 0}已完成{/if}
                                {/if}
                            {/if}
                        {else}
                            {if $log['status'] ==2 && $goods['goodstype']==3}{if $goods['type']==0}已兑换{else}已中奖{/if}，等待领取{/if}
                            {if $set['isreply'] == 1}
                                {if $log['status'] ==3 && $log['iscomment'] == 0 }等待评价{/if}
                                {if $log['status'] ==3 && $log['iscomment'] == 1 }追加评价{/if}
                                {if $log['status'] ==3 && $log['iscomment'] == 2 }
                                    {if $goods['goodstype']==1}优惠券{elseif $goods['goodstype']==2}余额{elseif $goods['goodstype']==3}红包{/if}已发放
                                {/if}
                            {else}
                                {if $log['status'] ==3}优惠券已发放{/if}
                            {/if}
                        {/if}
                    </div>
                    <div class='text'>
                        商品总额: {$goods['credit']}{$_W['shopset']['trade']['credittext']}
                        {if $goods['money'] > 0} + &yen; {$goods['money']}{/if}
                        {if $goods['goodstype']==0 && $goods['isverify']==0}
                            {if $goods['dispatch'] > 0}运费：&yen; {$goods['dispatch']}{else}免运费{/if}
                        {/if}
                    </div>
                </div>
                <div class='fui-list-media'>
                    {if $goods['goodstype']==0}
                        {if $goods['isverify']==1}
                            {if $log['status'] ==2}<i class='icon icon-money'></i>{/if}
                        {else}
                            {if $log['status'] ==2 && $log['time_send'] == 0}<i class='icon icon-money'></i>{/if}
                            {if $log['status'] ==2 && $log['time_send'] > 0 }<i class='icon icon-deliver'></i>{/if}
                        {/if}
                        {if $log['status'] ==3}<i class='icon icon-check'></i>{/if}
                    {elseif $goods['goodstype']==1}
                        {if $log['status'] ==3}<i class='icon icon-check'></i>{/if}
                    {elseif $goods['goodstype']==2}
                        {if $log['status'] ==3}<i class='icon icon-check'></i>{/if}
                    {elseif $goods['goodstype']==3}
                        {if $log['status'] ==2}<i class='icon icon-check'></i>{/if}
                    {/if}
                    {if $log['status'] ==1}
                    <i class='icon icon-roundclose'></i>
                    {/if}

                </div>
            </div>
        </div>
        {if $goods['goodstype']==0}
        {if !empty($address)}
        <div class='fui-list-group' style='margin-top:5px;'>
            {if $log['status'] == 3 && !empty($log['expresssn'])}
            <a href="{php echo mobileUrl('creditshop/log/express',array('id'=>$log['id']))}">
                <div class='fui-list'>
                    <div class='fui-list-media'><i class='icon icon-deliver'></i></div>
                    <div class='fui-list-inner'>
                        {if empty($express)}
                        <div class='text'><span>快递公司:{$log['expresscom']}</span></div>
                        <div class='text'><span>快递单号:{$log['expresssn']}</span></div>
                        {else}
                        <div class='text'><span {if $express && strexists($express['step'],'已签收')}class='text-danger'{/if}>{$express['step']}</span></div>
                        <div class='text'><span {if $express && strexists($express['step'],'已签收')}class='text-danger'{/if}>{$express['time']}</span></div>
                        {/if}
                    </div>
                    <div class='fui-list-angle'><span class='angle'></span></div>
                </div>
            </a>
            {/if}

            <div class='fui-list'>
                <div class='fui-list-media'><i class='icon icon-location'></i></div>
                <div class='fui-list-inner'>
                    <div class='title'>{$address['realname']} {$address['mobile']}</div>
                    <div class='text'>{$address['province']}{$address['city']}{$address['area']} {$address['address']}</div>
                </div>
            </div>
        </div>
        {else}
        {/if}
        {/if}
        {if $goods['isverify']==0 && $log['addressid']==0 && $goods['goodstype']==0}
        <div class="fui-cell-group">
            <div class="fui-cell ">
                <div class="fui-cell-label ">收货地址</div>
                <a class="fui-cell-info" href="{php echo mobileUrl('member/address/selector')}">
                    <input type="text" class="fui-input" placeholder="点击选择收货地址" readonly id="address_select" value="{$address['province']}{$address['city']}{$address['area']}{$address['address']}" />
                </a>
            </div>
        </div>
        {/if}
        {if !empty($carrier)}
        <div class='fui-list-group' style='margin-top:5px;'>
            <div class='fui-list' style="display: none;">
                <div class='fui-list-media'><i class='icon icon-person2'></i></div>
                <div class='fui-list-inner'>
                    <div class='title'>{$carrier['carrier_realname']} {$carrier['carrier_mobile']}</div>
                </div>
            </div>
            {if !empty($store)}
            <div  class="fui-list" >
                <div class="fui-list-media">
                    <i class='icon icon-shop'></i>
                </div>
                <div class="fui-list-inner store-inner">
                    <div class="title"> <span class='storename'>{$store['storename']}</span></div>
                    <div class="text">
                        <span class='realname'>{$store['realname']}</span> <span class='mobile'>{$store['mobile']}</span>
                    </div>
                    <div class="text">
                        <span class='address'>{$store['address']}</span>
                    </div>
                </div>
                <div class="fui-list-angle ">
                    {if !empty($store['tel'])}<a href="tel:{$store['tel']}" class='external '><i class=' icon icon-phone' style='color:green'></i></a>{/if}
                    <a href="{php echo mobileUrl('store/map',array('id'=>$store['id']))}" class='external' ><i class='icon icon-location' style='color:#f90'></i></a>
                </div>
            </div>

            {/if}
        </div>
        {/if}

        <div class="fui-list-group goods-list-group">
            <div class="fui-list-group-title"><i class="icon icon-shop"></i> {$_W['shopset']['shop']['name']}</div>
            <a href="{php echo mobileUrl('creditshop/detail',array('id'=>$goods['id']))}" class="external">
                <div class="fui-list goods-list">
                    <div class="fui-list-media">
                        <img src="{php echo tomedia($goods['thumb'])}" alt="{$goods['title']}" class="round" onerror="this.src='../addons/ewei_shopv2/static/images/nopic100.jpg'">
                    </div>
                    <div class="fui-list-inner">
                        <div class="text goodstitle">{$goods['title']}</div>
                        {if !empty($log['optionid'])}<div class='subtitle' style="font-size:0.6rem;color:#999;">规格：{$goods['optiontitle']}</div>{/if}
                    </div>
                    <div class='fui-list-angle'>
                        <span class='marketprice'>
                            {$goods['credit']}{$_W['shopset']['trade']['credittext']}{if $goods['money']>0}<br />&yen;{$goods['money']}{/if}
				            <br/>   x 1
                        </span>
                    </div>
                </div>
            </a>
        </div>


        {if !empty($order['virtual']) && !empty($order['virtual_str'])}
        <div class='fui-according-group'>
            <div class='fui-according expanded'>
                <div class='fui-according-header'>
                    <i class='icon icon-productfeatures'></i>
                    <span class="text">发货信息</span>
                    <span class="remark"></span>
                </div>
                <div class="fui-according-content">
                    <div class='content-block'>
                        {$order['virtual_str']}
                    </div>
                </div>

            </div></div>
        {/if}

        {if !empty($order['isvirtualsend']) && !empty($order['virtualsend_info'])}
        <div class='fui-according-group'>
            <div class='fui-according expanded'>
                <div class='fui-according-header'>
                    <i class='icon icon-productfeatures'></i>
                    <span class="text">发货信息</span>
                    <span class="remark"></span>
                </div>
                <div class="fui-according-content">
                    <div class='content-block'>
                        {$order['virtualsend_info']}
                    </div>
                </div>

            </div></div>
        {/if}

        {if $goods['isverify']==1 && $log['status'] > 1}

        <div class='fui-according-group expanded verify-container' data-verifytype="{$goods['verifytype']}" data-orderid="{$log['id']}">
            <div class='fui-according'>
                <div class='fui-according-header'>
                    <i class='icon icon-list'></i>
                    <span class="text">兑奖码</span>
                    <span class="remark"><div class="badge">1</div></span>
                </div>
                <div class="fui-according-content verifycode-container">

                    <div class='fui-cell-group'>
                        <div class='fui-cell verify-cell' data-verifycode="{$log['eno']}">
                            <div class='fui-cell-label' style='width:auto'>
                                {$log['eno']}
                            </div>
                            <div class='fui-cell-info'></div>
                            <div class='fui-cell-remark noremark'>
                                {if $verify['isverify']}
                                <div class='fui-label fui-label-danger' >已使用</div>
                                {else}
                                    {if $goods['verifytype']==1}
                                        {if $verifynum == 0}
                                            <div class='fui-label fui-label-danger' >已使用</div>
                                        {else}
                                            <div class='fui-label fui-label-default' >剩余{php echo $verifynum} 次</div>
                                        {/if}
                                    {else}
                                        <div class='fui-label fui-label-default' >未使用</div>
                                    {/if}
                                {/if}
                            </div>
                        </div>
                    </div>


                </div>
            </div>
        </div>

        {/if}

        {if !empty($stores) && $log['status'] > 1}
        <script language='javascript' src='http://api.map.baidu.com/api?v=2.0&ak=ZQiFErjQB7inrGpx27M1GR5w3TxZ64k7'></script>
        <div class='fui-according-group'>
            <div class='fui-according'>
                <div class='fui-according-header'>
                    <i class='icon icon-shop'></i>
                    <span class="text">适用门店</span>
                    <span class="remark"><div class="badge">{php echo count($stores)}</div></span>
                </div>
                <div class="fui-according-content store-container">
                    {loop $stores $item}
                    <div  class="fui-list store-item"

                          data-lng="{php echo floatval($item['lng'])}"
                          data-lat="{php echo floatval($item['lat'])}">
                        <div class="fui-list-media">
                            <i class='icon icon-shop'></i>
                        </div>
                        <div class="fui-list-inner store-inner">
                            <div class="title"> <span class='storename'>{$item['storename']}</span></div>
                            <div class="text">
                                <span class='realname'>{$item['realname']}</span> <span class='mobile'>{$item['mobile']}</span>
                            </div>
                            <div class="text">
                                <span class='address'>{$item['address']}</span>
                            </div>
                            <div class="text location" style="color:green;display:none">正在计算距离...</div>
                        </div>
                        <div class="fui-list-angle ">
                            {if !empty($item['tel'])}<a href="tel:{$item['tel']}" class='external '><i class=' icon icon-phone' style='color:green'></i></a>{/if}
                            <a href="{php echo mobileUrl('store/map',array('id'=>$item['id']))}" class='external' ><i class='icon icon-location' style='color:#f90'></i></a>
                        </div>
                    </div>
                    {/loop}
                </div>

                <div id="nearStore" style="display:none">

                    <div class='fui-list store-item'  id='nearStoreHtml'></div>
                </div>
            </div></div>
        {/if}




        <div class='fui-cell-group price-cell-group'>
            <div class="fui-cell">
                <div class="fui-cell-label">商品小计</div>
                <div class="fui-cell-info"></div>
                <div class="fui-cell-remark noremark">{$goods['credit']}{$_W['shopset']['trade']['credittext']} + &yen;{$goods['money']}</div>
            </div>
            {if $goods['goodstype']==0 && $goods['isverify']==0}
            <div class="fui-cell">
                <div class="fui-cell-label">运费</div>
                <div class="fui-cell-info"></div>
                <div class="fui-cell-remark noremark">{if $goods['dispatch'] > 0}¥ {$goods['dispatch']}{else}免运费{/if}</div>
            </div>
            {/if}
            <div class="fui-cell">
                <div class="fui-cell-label" style='width:auto;'>
                    实付费{if $goods['isverify']==0}(含运费){/if}
                </div>
                <div class="fui-cell-info"></div>
                <div class="fui-cell-remark noremark">
                    <span class='text-danger'>
                        {$goods['credit']}{$_W['shopset']['trade']['credittext']}{if ($goods['money'] + $goods['dispatch']) >0} + &yen; {php echo number_format($goods['money'] + $goods['dispatch'],2)}{/if}
                    </span>
                </div>
            </div>
        </div>

        <div class="fui-cell-group info-cell-group">
            <div class="fui-cell">
                <div class="fui-cell-label">订单编号:</div>
                <div class="fui-cell-info">{$log['logno']}</div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">创建时间:</div>
                <div class="fui-cell-info">{php echo date('Y-m-d H:i:s', $log['createtime'])}</div>
            </div>
            {if $log['status']>=1}
            <div class="fui-cell">
                <div class="fui-cell-label">支付时间: </div>
                <div class="fui-cell-info">{php echo date('Y-m-d H:i:s', $log['createtime'])}</div>
            </div>
            {/if}
            {if $log['status']>=2 && $log['time_send'] > 0}
            <div class="fui-cell">
                <div class="fui-cell-label">发货时间: </div>
                <div class="fui-cell-info">{php echo date('Y-m-d H:i:s', $log['time_send'])}</div>
            </div>
            {/if}
            {if $log['status']==3 && $log['time_finish'] > 0}
            <div class="fui-cell">
                <div class="fui-cell-label">完成时间: </div>
                <div class="fui-cell-info">{php echo date('Y-m-d H:i:s', $log['time_finish'])}</div>
            </div>
            {/if}
        </div>


    </div>

    <div class='fui-footer'>
        {if $goods['isverify']==0 && $goods['goodstype']==0 && $log['addressid']==0 }
            {if $goods['dispatch'] >0}
                <div class="btn btn-warning block btn-1">支付运费</div>
            {else}
                <div class="btn btn-warning block btn-1">确认兑换</div>
            {/if}
        {/if}
        {if $goods['goodstype'] == 0 &&  $goods['isverify'] > 0 && ($log['status'] == 2 || $log['status'] == 3 && $verifynum > 0)}
        <a class="btn btn-default" href="{php echo mobileUrl('creditshop/verify',array('logid'=>$log['id'],'verifycode'=>$log['eno']))}">
            <i class="icon icon-qrcode" style="vertical-align: middle;"></i>
            <span>兑换二维码</span>
        </a>
        {/if}
        {if $set['isreply']==1  && $log['time_finish'] > 0 }
            {if $goods['goodstype']==0 || $goods['goodstype']==1}
                {if $log['status'] == 3 && $log['iscomment'] == 1}
                    <a class="btn btn-default" href="{php echo mobileUrl('creditshop/comment',array('goodsid'=>$log['goodsid'],'logid'=>$log['id']))}">追加评价</a>
                {/if}
                {if $log['status'] == 3 && $log['iscomment'] == 0}
                    <a class="btn btn-default" href="{php echo mobileUrl('creditshop/comment',array('goodsid'=>$log['goodsid'],'logid'=>$log['id']))}">评价</a>
                {/if}
            {else if $goods['goodstype']==2 || $goods['goodstype']==3}
                {if $log['status'] ==3 && $log['iscomment'] == 1}
                    <a class="btn btn-default" href="{php echo mobileUrl('creditshop/comment',array('goodsid'=>$log['goodsid'],'logid'=>$log['id']))}">追加评价</a>
                {/if}
                {if $log['status'] ==3 && $log['iscomment'] == 0}
                    <a class="btn btn-default" href="{php echo mobileUrl('creditshop/comment',array('goodsid'=>$log['goodsid'],'logid'=>$log['id']))}">评价</a>
                {/if}
            {/if}
        {/if}
        {if $goods['goodstype']==0 && $log['status']==3 && $log['time_send'] > 0 && $log['time_finish'] == 0}
        <div class="btn btn-default btn-default-o order-finish" data-logid="{$log['id']}">确认收货</div>
        {/if}
        {if $goods['goodstype']==3 && $log['status']==2}
        <div class="btn btn-default btn-default-o order-packet" data-logid="{$log['id']}">领取红包</div>
        {/if}
    </div>
    <script language='javascript'>
        require(['../addons/ewei_shopv2/plugin/creditshop/static/js/log_detail.js'], function (modal) {
            modal.init({goods: {php echo json_encode($goods)}, log: {php echo json_encode($log)}});
        });
    </script>
    {if com('verify')}
    {template 'groups/orders/verify'}
    {/if}
</div>
{template '_footer'}